package org.arrow.tap.components;

import java.util.HashMap;

import org.apache.log4j.Logger;
import org.apache.tapestry5.annotations.SessionState;

public class BasePage {
	private static final Logger log = Logger.getLogger(BasePage.class);
	
    @SessionState(create=false)
    private HashMap nowUser;
    
    private boolean nowUserExists;
    
    public boolean isLogin(){
    	return nowUserExists;
    }
    
    public HashMap getNowUser(){
    	return nowUser;
    }
    
    public Long getUserId(){
    	return (Long)nowUser.get("id");
    }
    
    public Long getVersion(){
    	return (Long.parseLong("1"));
    }
    
    public String getTimeZone(){
    	return (String)nowUser.get("timeZone");
    }
    
    Object onException(Throwable cause)
    {
    	cause.printStackTrace();
    	log.error(cause.getMessage());
      //message = cause.getMessage();
    	return this;
    }
}
